package co.za.alicrity.exactcover;

import java.util.ArrayList;
import java.util.List;

import javax.swing.plaf.SliderUI;

public class SolutionList {
	
	private List<List<Integer>> solutions = new ArrayList<List<Integer>>();
	private ExactCoverMatrix original;
	
	public SolutionList(ExactCoverMatrix original){
		this.original=original;
	}

	public void addSolution(List<Integer> solutionsRows) {
		solutions.add(solutionsRows);
		System.out.println(solutions.size());
	}
	
	public String toString(){
		String n="";
		for (List<Integer> r : solutions){
			for (Integer k : r){
				n+=k+",";
			}
			n+="\n";
		}
		return n;
	}
	
	public boolean hasSolution(){
		return solutions.size()>0;
	}
	
	public void applySolution(int n){
		original.applySolution(solutions.get(n));
	}

}
